package cn.myeasyai.controller.ai;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.ollama.api.OllamaApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Config {
    @Bean
    public  ChatClient.Builder  Builder( OllamaApi ollamaApi ){
        final OllamaChatModel ollamaChatModel = OllamaChatModel.builder().ollamaApi(ollamaApi).build();
        ChatClient.Builder builder = ChatClient.builder(ollamaChatModel);
        return builder;


    }
    @Bean
    public  OllamaApi  ollamaApi( ){
        return new OllamaApi("http://localhost:11434");

    }
}
